# Contributor: Roberto Oliveira <robertoguimaraes8@gmail.com>
# Maintainer: Apo Apangona <apo@apangona.de>
pkgname=ledger
pkgver=3.3.2
pkgrel=2
pkgdesc="Double-entry accounting system with a command-line reporting interface"
url="https://www.ledger-cli.org/"
arch="all"
license="BSD-3-Clause"
makedepends="
	boost-dev
	cmake
	doxygen
	gettext-dev
	gmp-dev
	graphviz
	mpfr-dev
	samurai
	texinfo
	"
subpackages="$pkgname-doc"
options="!check" # FIXME: some tests are failing
source="$pkgname-$pkgver.tar.gz::https://github.com/ledger/ledger/archive/v$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja\
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		$CMAKE_CROSSOPTS
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
d5d7058f0e9a02ad1d46e6780675d446070824b321f0f4c1ea6ac0c3dd4f11f259113bc36cbc796e4bb6d0a7898d6a68a25cce639e27a2b2434eec11a612ecb0  ledger-3.3.2.tar.gz
"
